var Fight,
  __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, i) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var i in e)
              Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
          })(e, i);
      };
      return function (e, i) {
        function n() {
          this.constructor = e;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        t(e, i),
          (e.prototype =
            null === i
              ? Object.create(i)
              : ((n.prototype = i.prototype), new n()));
      };
    })();
!(function (t) {
  var e = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.skin = "comp/commonpic/btn_box_organe.png"),
        (e.speedSkin = [
          "",
          "comp/commonpic/btn_speed1.png",
          "comp/commonpic/btn_speed2.png",
          "comp/commonpic/btn_speed3.png",
          "comp/commonpic/btn_speed5.png",
          "comp/commonpic/btn_speed8.png",
          "comp/commonpic/btn_speed10.png",
        ]),
        (e.inited = !1),
        (e.speedNum = 1),
        (e.maxSpeed = 1),
        (e.visible = !1),
        e
      );
    }
    return (
      __extends(e, t),
      (e.prototype.init = function () {
        var t = new Laya.Button(this.skin);
        this.addChild(t),
          (t.width = e.btn_Width),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(32.5, 0),
          (t.label = "技 能"),
          (t.name = "skill"),
          t.on(Laya.Event.CLICK, this, this.onClick),
          (t.labelBold = !0),
          (this.skill = t),
          (t = new Laya.Button(this.skin)),
          this.addChild(t),
          (t.width = e.btn_Width),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(97.5, 0),
          (t.label = "物 品"),
          (t.name = "goods"),
          t.on(Laya.Event.CLICK, this, this.onClick),
          (t.labelBold = !0),
          (this.goods = t),
          (t = new Laya.Button(this.skin)),
          this.addChild(t),
          (t.width = e.btn_Width),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(162.5, 0),
          (t.label = "攻 击"),
          (t.name = "attack"),
          t.on(Laya.Event.CLICK, this, this.onClick),
          (t.labelBold = !0),
          (this.attack = t),
          (t = new Laya.Button(this.skin)),
          this.addChild(t),
          (t.width = e.btn_Width),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(0, 30),
          (t.label = "逃 跑"),
          (t.name = "flee"),
          t.on(Laya.Event.CLICK, this, this.onClick),
          (t.labelBold = !0),
          (this.flee = t),
          (t = new Laya.Button(this.skin)),
          this.addChild(t),
          (t.width = e.btn_Width),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(65, 30),
          (t.label = "招 降"),
          (t.name = "catch"),
          t.on(Laya.Event.CLICK, this, this.onClick),
          (t.labelBold = !0),
          (this.catch = t),
          (t = new Laya.Button(this.skin)),
          this.addChild(t),
          (t.width = e.btn_Width),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(130, 30),
          (t.label = "招 将"),
          (t.name = "summon"),
          t.on(Laya.Event.CLICK, this, this.onClick),
          (t.labelBold = !0),
          (this.summon = t),
          (t = new Laya.Button(this.skin)),
          this.addChild(t),
          (t.width = e.btn_Width),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(195, 30),
          (t.label = "防 御"),
          (t.name = "defense"),
          t.on(Laya.Event.CLICK, this, this.onClick),
          (t.labelBold = !0),
          (this.defense = t),
          (t = new Laya.Button(this.skin)),
          this.addChild(t),
          (t.width = e.btn_Width + 10),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(47.5, 60),
          (t.label = "自动战斗"),
          (t.name = "auto"),
          t.on(Laya.Event.CLICK, this, this.onAutoClick),
          (t.labelBold = !0),
          (this.auto = t),
          (t = new Laya.Button(this.speedSkin[1])),
          this.addChild(t),
          (t.width = e.btn_Width + 10),
          (t.height = e.btn_Height),
          (t.labelSize = e.btn_FontSize),
          (t.labelColors = e.btn_FontColors),
          t.pos(132.5, 60),
          (t.name = "speed"),
          t.on(Laya.Event.CLICK, this, this.onSpeedClick),
          (t.labelBold = !0),
          (t.stateNum = 1),
          (this.speedNum = 1),
          (this.speed = t),
          (this.inited = !0);
      }),
      (e.prototype.onClick = function (t) {
        this.clearSel(),
          (this.selected = t.target),
          (t.target.selected = !0),
          this.parent.event("FightButton", t.target.name);
      }),
      (e.prototype.onAutoClick = function (t) {
        this.clearSel();
        var e = this.auto;
        e.selected
          ? ((e.selected = !1), (e.label = "自动战斗"))
          : ((e.selected = !0), (e.label = "取消自动")),
          this.parent.event("FightButton", "auto");
      }),
      (e.prototype.onSpeedClick = function () {
        var t = this.speedNum;
        this.maxSpeed == t ? (t = 1) : (t += 1),
          (this.speedNum = t),
          (this.speed.skin = this.speedSkin[t]),
          this.parent.event("FightButton", "speed");
      }),
      (e.prototype.clearSel = function () {
        this.selected && (this.selected.selected = !1);
      }),
      (e.prototype.reset = function (t, e) {
        this.inited &&
          (1 == t && ((this.flee.disabled = !1), (this.summon.disabled = !1)),
          2 == t && ((this.flee.disabled = !0), (this.summon.disabled = !0)),
          (this.skill.disabled = (256 & e) > 0));
      }),
      (e.prototype.resetAuto = function () {
        var t = this.auto;
        t.selected && ((t.selected = !1), (t.label = "自动战斗"));
      }),
      (e.prototype.show = function () {
        this.inited || (this.init(), this.initSpeedBtn()),
          this.visible || (this.visible = !0),
          this.changeShow(!0);
      }),
      (e.prototype.hiden = function () {
        this.visible = !1;
      }),
      (e.prototype.changeShow = function (t) {
        (this.skill.visible = t),
          (this.goods.visible = t),
          (this.flee.visible = t),
          (this.attack.visible = t),
          (this.catch.visible = t),
          (this.summon.visible = t),
          (this.defense.visible = t);
      }),
      (e.prototype.initSpeedBtn = function () {
        this.inited &&
          (Global.roleVip < 2
            ? ((this.maxSpeed = 1), (this.speed.disabled = !0))
            : ((this.speed.disabled = !1),
              Global.roleVip <= 9 && (this.maxSpeed = 6),
              Global.roleVip <= 8 && (this.maxSpeed = 5),
              Global.roleVip <= 7 && (this.maxSpeed = 4),
              Global.roleVip <= 5 && (this.maxSpeed = 3),
              Global.roleVip <= 3 && (this.maxSpeed = 2)));
      }),
      (e.btn_Width = 60),
      (e.btn_Height = 28),
      (e.btn_FontSize = 14),
      (e.btn_FontColors = "#FFFFFF"),
      e
    );
  })(Laya.Sprite);
  t.FightButton = e;
})(Fight || (Fight = {}));
